/*
 * @Author: KG
 * @Date: 2024-12-12 14:15:06
 * @LastEditors: KG
 * @LastEditTime: 2024-12-12 18:41:24
 * @FilePath: \dk-world\public\native\modules\three-flatten.js
 * @Description:
 *
 */
import { jsonToVec3 } from '../core/common.js';
import Store from '../core/store.js';
import global from '../core/global.js';
const FlattenMaskStore = new Store();
export const addFlattenMask = (options, cb) => {
	const { pointList, tilesId } = options;
	const list = jsonToVec3(pointList);
	let mask = new SSmap.FlattenMask();
	mask.maskHeight = 68; // maskHeight 只对地形生效

	mask.setPoints(list);
	const tileset = global.tilesList.get(tilesId);
	tileset.addFlattenMask(mask);
	let id = FlattenMaskStore.add(mask, options.id);
	cb && cb(id);
};
export const removeFlattenMask = ({ maskId, tilesId } = {}) => {
	const tileset = global.tilesList.get(tilesId);
	const mask = FlattenMaskStore.get(maskId);
	mask && tileset && tileset.removeFlattenMask(mask);
};
